<template>
  <div class="h-6" />
  <el-menu :default-active="activeIndex2" class="el-menu-demo" mode="horizontal" background-color="#545c64"
    text-color="#fff" active-text-color="#ffd04b" @select="handleSelect">
    <el-sub-menu index="2">
      <template #title>溯源详细</template>
      <el-menu-item index="2-1" @click="SY">显示</el-menu-item>
      <el-menu-item index="2-2" @click="SY">溯源</el-menu-item>
    </el-sub-menu>
    <el-menu-item index="3" style="left: 700Px;">账号 {{ Store.MapPiain.userName }} 角色 {{ Store.MapPiain.roleName }} 姓名
      {{ Store.MapPiain.userNickname }}</el-menu-item>
    <el-menu-item index="4" style="left: 700Px;" @click="TC">退出登录</el-menu-item>
  </el-menu>
  <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
    <el-tab-pane label="溯源详细" name="first">
      <el-form>
        <table>
          <tr>
            <td>
              <el-form-item label="" style="margin-bottom: 110px;">
                <img v-if="from.traceabilityPhoto" :src="from.traceabilityPhoto" style="width: 150px; height: 150px;" />
              </el-form-item>
            </td>
          <tr>
            <td>
              <el-form-item label="生产批次">
                <span>:{{ from.traceabilityBatch }}</span>
              </el-form-item>
            </td>
            <td>
              <el-form-item label="保质期">
                <span>:{{ from.traceabilityShelf }}</span>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <td>
              <el-form-item label="生产许可证">
                <span>:{{ from.traceaDocuments }}</span>
                &emsp;
                &emsp;
              </el-form-item>
            </td>
            <td>
              <el-form-item label="生产企业">
                <span>:{{ from.manufacturers }}</span>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <span>产品质检报告</span>
        <el-upload
        v-model:file-list="fileList1"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>

          </tr>
          </tr>
        </table>
        
      </el-form>
    </el-tab-pane>
  </el-tabs>
  <el-tabs type="border-card">
    <el-tab-pane label="养殖信息">
      <span style="color: #409EFF;">养殖信息</span>
      &emsp;
      <el-button @click="dialogFormVisible = true">设置</el-button>
      <el-divider />
      <table>
        <tr>
          <td>
            <el-form-item label="品牌">
              <span>:&emsp;{{ Data.variety }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="来源">
              <span>:&emsp;{{ Data.source }}</span>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td>
            <el-form-item label="饲养天数">
              <span>:&emsp;{{ Data.cultivationDay
                }}</span>
            </el-form-item>
          </td>
          <td><el-form-item label="饲养品牌">
              <span>:&emsp;{{ Data.cultivationBrand }}</span>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td>
            <el-form-item label="饲养负责人">
              <span>:&emsp;{{ Data.cultivationHead }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="出栏日期">
              <span>:&emsp;{{ Data.cultivationTime }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span style="color: #409EFF;">保健信息</span>
      &emsp;

      <el-button @click="addRow">新增行</el-button>
  <el-divider />
  <el-table :data="tableDatas" border style="width: 600px">
    <el-table-column prop="feedingDay" label="饲养天数">
      <template v-slot="scope">
        <el-input v-model="scope.row.feedingDay" placeholder="请输入饲养天数" />
      </template>
    </el-table-column>
    <el-table-column prop="manner" label="保健方式">
      <template v-slot="scope">
        <el-input v-model="scope.row.manner" placeholder="请输入保健方式" />
      </template>
    </el-table-column>
    <el-table-column prop="method" label="保健方法">
      <template v-slot="scope">
        <el-input v-model="scope.row.method" placeholder="请输入保健方法" />
      </template>
    </el-table-column>
    <el-table-column label="操作">
      <template v-slot="scope">
        <el-button @click="saveRow(scope.$index)" style="width: 30px;">保存</el-button>
        <el-button @click="editRow(scope.$index)" style="width: 30px;">修改</el-button>
        <el-button @click="deleteRow(scope.$index)" style="width: 30px;">删除</el-button>
      </template>
    </el-table-column>
  </el-table>


      <span style="color: #409EFF;">动检证</span>
      <el-divider />
      <el-upload
        v-model:file-list="fileList2"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>
      &emsp;
      <br />
      &emsp;
      <br />
      &emsp;
      <br />
      &emsp;
      <br />
      <span style="color: #409EFF;">企业信息</span>
      &emsp;
      <el-button @click="dialogFormVisibles = true">设置</el-button>
      <el-divider />
      <table>
        <tr>
          <td>
            <el-form-item label="养殖场">
              <span>:&emsp;{{ BassData.farms }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="负责人">
              <span>:&emsp;{{ BassData.head }}</span>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td>
            <el-form-item label="存栏数量">
              <span>:&emsp;{{ BassData.quantityNum }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>

      <span style="color: #409EFF;">企业照片</span>
      <el-divider />
      <el-upload
        v-model:file-list="fileList3"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>
    </el-tab-pane>
    <el-tab-pane label="屠宰信息">
      <span style="color: #409EFF;">屠宰信息</span>
      &emsp;
      <el-button @click="dialogFormVisible3 = true">设置</el-button>
      <el-divider />
      <table>
        <tr>
          <td>
            <el-form-item label="批次">
              <span>:&emsp;{{ slaugData.slaughterBatch }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="到厂数量">
              <span>:&emsp;{{ slaugData.slaughterWeight }}</span>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td>
            <el-form-item label="到厂时间">
              <span>:&emsp;{{ slaugData.dtime }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="屠宰时间">
              <span>:&emsp;{{ slaugData.slaughterTime }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span style="color: #409EFF;">相关资质</span>
      <el-divider />
      <el-upload
        v-model:file-list="fileList4"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>
      <span style="color: #409EFF;">企业信息</span>
      &emsp;
      <el-button @click="dialogFormVisible4 = true">设置</el-button>
      <el-divider />
      <table>
        <tr>
          <td>
            <el-form-item label="公司名称">
              <span>:&emsp;{{ slaughBass.firmName }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="建立时间">
              <span>:&emsp;{{ slaughBass.firmTime }}</span>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td>
            <el-form-item label="公司地址">
              <span>:&emsp;{{ slaughBass.firmAddr }}</span>
            </el-form-item>
          </td>
        </tr>
        <tr>
          <td>
            <el-form-item label="公司简介">
              <span>:&emsp;{{ slaughBass.firmContext }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span style="color: #409EFF;">企业照片</span>
      <el-divider />

      <el-upload
        v-model:file-list="fileList5"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>

    </el-tab-pane>
    <el-tab-pane label="深加工信息">
      <span style="color: #409EFF;">深加工信息</span>
      &emsp;
      <el-button @click="dialogFormVisible5 = true">设置</el-button>
      <el-divider />

      <table>
        <tr>
          <td> <el-form-item label="班组">
              <span>:&emsp;{{ ProcessingData.processingTeam }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="负责人">
              <span>:&emsp;{{ ProcessingData.processingHead }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span style="color: #409EFF;">食品安全信息</span>
      <el-divider />

      <el-upload
        v-model:file-list="fileList6"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>

      <span style="color: #409EFF;">供应商信息</span>
      <el-divider />
      <span>原料</span>
      &emsp;
      <el-button @click="dialogFormVisible7 = true">设置</el-button>
      <table>
        <tr>
          <td>
            <el-form-item label="生产批次">
              <span>:&emsp;{{ FeedbackData.feedstockName }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span>相关资料</span>
      <el-divider />
      <el-upload
        v-model:file-list="fileList7"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>

      <span>辅料</span>
      &emsp;
      <el-button>设置</el-button>
      <table>
        <tr>
          <td>
            <el-form-item label="生产批次">
              <span>:&emsp;{{ FeedbackData.feedstockName }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span>相关资料</span>
      <el-divider />

      <el-upload
        v-model:file-list="fileList8"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>

      <span>添加剂</span>
      &emsp;
      <el-button>设置</el-button>
      <table>
        <tr>
          <td>
            <el-form-item label="生产批次">
              <span>:&emsp;{{ FeedbackData.feedstockName }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span>相关资料</span>
      <el-divider />

      <el-upload
        v-model:file-list="fileList9"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>
      <span>包材</span>
      &emsp;
      <el-button>设置</el-button>
      <table>
        <tr>
          <td>
            <el-form-item label="生产批次">
              <span>:&emsp;{{ FeedbackData.feedstockName }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span>相关资料</span>
      <el-divider />

      <el-upload
        v-model:file-list="fileList10"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>
      <span style="color: #409EFF;">企业信息</span>
      &emsp;
      <el-button @click="dialogFormVisible6 = true">设置</el-button>
      <el-divider />
      <table>
        <tr>
          <td>
            <el-form-item label="公司名称">
              <span>:&emsp;{{ ProcessingBass.firmName }}</span>
            </el-form-item>
          </td>
          <td>
            <el-form-item label="生产许可证">
              <span>:&emsp;{{ ProcessingBass.productionNo }}</span>
            </el-form-item>
          </td>
        </tr>
      </table>
      <span style="color: #409EFF;">企业照片</span>
      <el-divider />

      <el-upload
        v-model:file-list="fileList11"
        action="https://localhost:44393/api/one/UploadPhoto"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
        >
        <el-icon><Plus /></el-icon>
        </el-upload>

        <el-dialog v-model="dialogVisible">
        <img w-full :src="dialogImageUrl" alt="Preview Image" />
        </el-dialog>
    </el-tab-pane>
  </el-tabs>
  <!-- 养殖信息弹出层 -->
  <el-dialog v-model="dialogFormVisible" title="养殖信息" width="500">
    <el-form :model="Data">
      <el-form-item label="品种">
        <el-input v-model="Data.variety" />
      </el-form-item>
      <el-form-item label="来源">
        <el-input v-model="Data.source" />
      </el-form-item>
      <el-form-item label="饲养天数">
        <el-input v-model="Data.cultivationDay" />
      </el-form-item>
      <el-form-item label="饲养品牌">
        <el-input v-model="Data.cultivationBrand" />
      </el-form-item>
      <el-form-item label="饲养负责人">
        <el-input v-model="Data.cultivationHead" />
      </el-form-item>
      <el-form-item label="出栏日期">
        <el-date-picker v-model="Data.cultivationTime" type="date" placeholder="Pick a date" style="width: 100%" />
      </el-form-item>
      <el-form-item label="饲养照片">
        <el-input v-model="Data.cultivationPhoto" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="AddData">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
  <!-- 企业信息弹出层 -->
  <el-dialog v-model="dialogFormVisibles" title="企业信息" width="500">
    <el-form :model="BassData">
      <el-form-item label="养殖场">
        <el-input v-model="BassData.farms" />
      </el-form-item>
      <el-form-item label="负责人">
        <el-input v-model="BassData.head" />
      </el-form-item>
      <el-form-item label="存栏数量">
        <el-input v-model="BassData.quantityNum" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisibles = false">取消</el-button>
        <el-button type="primary" @click="BassAdd">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
  <!-- 屠宰信息弹出层 -->
  <el-dialog v-model="dialogFormVisible3" title="屠宰信息" width="500">
    <el-form :model="slaugData">
      <el-form-item label="批次">
        <el-input v-model="slaugData.slaughterBatch" />
      </el-form-item>
      <el-form-item label="到厂均量">
        <el-input v-model="slaugData.slaughterWeight" />
      </el-form-item>
      <el-form-item label="到厂时间">
        <el-date-picker v-model="slaugData.dtime" type="date" placeholder="Pick a date" style="width: 100%" />
      </el-form-item>
      <el-form-item label="屠宰时间">
        <el-date-picker v-model="slaugData.slaughterTime" type="date" style="width: 100%" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible3 = false">取消</el-button>
        <el-button type="primary" @click="GetSlaug">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
  <!-- 屠宰公司弹出层 -->
  <el-dialog v-model="dialogFormVisible4" title="屠宰公司" width="500">
    <el-form :model="slaughBass">
      <el-form-item label="公司姓名">
        <el-input v-model="slaughBass.firmName" />
      </el-form-item>
      <el-form-item label="公司地址">
        <el-input v-model="slaughBass.firmAddr" />
      </el-form-item>
      <el-form-item label="成立时间">
        <el-date-picker v-model="slaughBass.firmTime" type="date" placeholder="Pick a date" style="width: 100%" />
      </el-form-item>
      <el-form-item label="公司简介">
        <el-input v-model="slaughBass.firmContext" type="textarea" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible4 = false">取消</el-button>
        <el-button type="primary" @click="slaughBassAdd">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
  <!-- 深加工信息弹出层 -->
  <el-dialog v-model="dialogFormVisible5" title="深加工信息" width="500">
    <el-form :model="ProcessingData">
      <el-form-item label="班组" >
        <el-input v-model="ProcessingData.processingTeam" />
      </el-form-item>
      <el-form-item label="负责人" >
        <el-input v-model="ProcessingData.processingHead" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible5 = false">取消</el-button>
        <el-button type="primary" @click="GetProcessing">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
  <!-- 深加工公司弹出层 -->
  <el-dialog v-model="dialogFormVisible6" title="深加工公司" width="500">
    <el-form :model="ProcessingBass">
      <el-form-item label="公司名称" >
        <el-input v-model="ProcessingBass.firmName" />
      </el-form-item>
      <el-form-item label="生产系列号" >
        <el-input v-model="ProcessingBass.productionNo" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible6 = false">取消</el-button>
        <el-button type="primary" @click="GetProcessingBass">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
  <!-- 原料弹出层 -->
  <el-dialog v-model="dialogFormVisible7" title="材料" width="500">
    <el-form :model="FeedbackData">
      <el-form-item label="生产批次" >
        <el-input v-model="FeedbackData.feedstockName" />
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogFormVisible7 = false">取消</el-button>
        <el-button type="primary" @click="GetFeedbackData">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup lang="ts">

import { ref, reactive, onMounted, watch, resolveDirective } from 'vue';
import axiox from 'axios';
import { ElMessage, ElMessageBox } from 'element-plus';
import { useCounterStore } from '@/stores/counter';
import { useRouter, useRoute } from 'vue-router';
const router = useRouter();
const route = useRoute();

const Store = useCounterStore();


const tableDatas = ref([
  { feedingDay: '', manner: '', method: '' }
]);

const addRow = () => {
  tableDatas.value.push({ feedingDay: '', manner: '', method: '' });
};

const saveRow = (index) => {
  // 保存行的逻辑
  ElMessage.success('保存成功');
};

const editRow = (index) => {
  // 修改行的逻辑
  ElMessage.success('修改成功');
};

const deleteRow = (index) => {
  tableDatas.value.splice(index, 1);
  ElMessage.success('删除成功');
};

onMounted(() => {
  // 初始化数据
  axios.get('https://localhost:44393/api/one/Vaccion').then(res => {
    tableDatas.value = res.data.data;
  });
});





///多张照片
import type { UploadProps, UploadUserFile } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
const dialogImageUrl = ref('')
const dialogVisible = ref(false)
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
  console.log(uploadFile, uploadFiles)
}
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
  dialogImageUrl.value = uploadFile.url!
  dialogVisible.value = true
}
/* const fileList = ref<UploadUserFile[]>([
])  */


//养殖信息弹出层
const dialogFormVisible = ref(false)
//企业信息弹出层
const dialogFormVisibles = ref(false)
//屠宰信息弹出层 
const dialogFormVisible3 = ref(false)
//屠宰公司弹出层 
const dialogFormVisible4 = ref(false)
//深加共信息弹出层 
const dialogFormVisible5 = ref(false)
//深加工公司弹出层 
const dialogFormVisible6 = ref(false)
//原料弹出层
const dialogFormVisible7 = ref(false)

///养殖信息数据
const Data = reactive({
  cultivationId: 0,
  variety: "",
  source: "",
  cultivationDay: 0,
  cultivationBrand: "",
  cultivationHead: "",
  cultivationTime: "",
  cultivationPhoto: ""
})
const AddData = () => {
  axiox.post("https://localhost:44393/api/one/CultivationAdd", Data).then(res => {
    if (res.data.code == 200) {
      ElMessage.success(res.data.message);
      return;
    }
    else {
      ElMessage.error(res.data.message);
      return;
    }
  })
}
///养殖企业数据
const BassData = reactive({
  breedBassId: 0,
  farms: "",
  head: "",
  quantityNum: "",
  breedPhoto: ""
})
const BassAdd = () => {
  axiox.post("https://localhost:44393/api/one/BreedBassAdd", BassData).then(res => {
    if (res.data.code == 200) {
      ElMessage.success(res.data.message);
      return;
    }
    else {
      ElMessage.error(res.data.message);
      return;
    }
  })
}
///获取养殖公司的数据
const Bassshow = ref([]);
const GetBassShow = () => {
  axiox.get("https://localhost:44393/api/one/BreedShow").then(res => {
    Bassshow.value = res.data.data;
    BassData.farms = res.data.data[0].farms;
    BassData.head = res.data.data[0].head;
    BassData.quantityNum = res.data.data[0].quantityNum;
  })
}
///获取疫苗数据
const vaccion = reactive({
  feedingDay: 0,
  manner: "",
  method: ""
})
const tableData = ref([]);
const GettableData = () => {
  axiox.get("https://localhost:44393/api/one/Vaccion").then(res => {
    tableData.value = res.data.data;
  })
}
///获取养殖信息的数据
const Getshow = ref([]);
const getshow = () => {
  axiox.get("https://localhost:44393/api/one/CultivationShow").then(res => {
    Getshow.value = res.data.data;
    Data.variety = res.data.data[0].variety;
    Data.source = res.data.data[0].source;
    Data.cultivationTime = res.data.data[0].cultivationTime;
    Data.cultivationDay = res.data.data[0].cultivationDay;
    Data.cultivationHead = res.data.data[0].cultivationHead;
    Data.cultivationBrand = res.data.data[0].cultivationBrand;
    console.log(res);
  })
}
///获取溯源信息
const from = reactive({
  traceabilityId: route.query.id,
  commodityId: 0,
  traceabilityBatch: "",
  traceabilityShelf: "",
  traceaDocuments: "",
  manufacturers: "",
  traceabilityPhoto: ""
})
const ftdate = ref([]);
const Getft = () => {
  axiox.get("https://localhost:44393/api/one/FTTraceability", {
    params: {
      traceabilityId: from.traceabilityId
    }
  }).then(res => {
    ftdate.value = res.data.data;
    from.traceabilityBatch = res.data.data.traceabilityBatch;
    from.traceabilityShelf = res.data.data.traceabilityShelf;
    from.traceaDocuments = res.data.data.traceaDocuments;
    from.manufacturers = res.data.data.manufacturers;
    from.traceabilityPhoto = res.data.data.traceabilityPhoto;

  })
}
//屠宰信息数据
const slaugData = reactive({
  slaughterId: 0,
  slaughterBatch: "",
  slaughterWeight: 0,
  dtime: "",
  slaughterTime: "",
  isDeleted: true
});
const GetSlaug = () => {
  axiox.post("https://localhost:44393/api/one/SlauggterAdd", slaugData).then(res => {
    if (res.data.code == 200) {
      ElMessage.success(res.data.message);
      return;
    }
    else {
      ElMessage.error(res.data.message);
      return;
    }
  })
}
//获取屠宰信息
const slaugShow = ref([]);
const GetSlaugShow = () => {
  axiox.get("https://localhost:44393/api/one/SlauggterShow").then(res => {
    slaugShow.value = res.data.data;
    slaugData.dtime = res.data.data[0].dtime;
    slaugData.slaughterBatch = res.data.data[0].slaughterBatch;
    slaugData.slaughterWeight = res.data.data[0].slaughterWeight;
    slaugData.slaughterTime = res.data.data[0].slaughterTime;
  })
}
//屠宰公司数据
const slaughBass = reactive({
  firmName: "",
  province: 0,
  city: 0,
  county: 0,
  firmAddr: "",
  firmTime: "",
  firmContext: "",
  firmPhoto: "",
  isDeleted: true
})
const slaughBassAdd = () => {
  axiox.post("https://localhost:44393/api/one/SlauggterBassAdd", slaughBass).then(res => {
    if (res.data.code == 200) {
      ElMessage.success(res.data.message);
      return;
    }
    else {
      ElMessage.error(res.data.message);
      return;
    }
  })
}
//获取屠宰公司显示
const SlaughterShowData = ref([]);
const SlaughterShow = () => {
  axios.get("https://localhost:44393/api/one/SlaughterBassShow").then(res => {
    SlaughterShowData.value = res.data.data;
    slaughBass.firmAddr = res.data.data[0].firmAddr;
    slaughBass.firmName = res.data.data[0].firmName;
    slaughBass.firmTime = res.data.data[0].firmTime;
    slaughBass.firmContext = res.data.data[0].firmContext;
  })
}
//深加工数据
const ProcessingData=reactive({
  processingId: 0,
  processingTeam: "",
  processingHead: "",
  processingPhoto: "",
  isDeleted: true
})
const GetProcessing=()=>{
  axios.post("https://localhost:44393/api/one/ProcessingAdd",ProcessingData).then(res=>{
    if(res.data.code==200){
      ElMessage.success(res.data.message);
      return;
    }
    else
    {
      ElMessage.error(res.data.message);
      return;
    }
  })
}
//深加工数据显示
const ProcessingDataShow=ref([]);
const GetProcessingShow=()=>{
  axios.get("https://localhost:44393/api/one/ProcessingShow").then(res=>{
    ProcessingDataShow.value=res.data.data;
    ProcessingData.processingTeam=res.data.data[0].processingTeam;
    ProcessingData.processingHead=res.data.data[0].processingHead;
  })
}
//深加工公司
const ProcessingBass=reactive({
  processingFirmId: 0,
  firmName: "",
  productionNo: "",
  firmPhoto: "",
  isDeleted: true
})
const GetProcessingBass=()=>{
  axios.post("https://localhost:44393/api/one/ProcessingFrimAdd",ProcessingBass).then(res=>{
    if(res.data.code==200)
  {
    ElMessage.success(res.data.message);
    return;
  }
  else
  {
    ElMessage.error(res.data.message);
    return;
  }
  })
}
//深公司显示
const ProcessingBassShow=ref([]);
const GetProcessingBassShow=()=>{
  axios.get("https://localhost:44393/api/one/ProcessingBassShow").then(res=>{
    ProcessingBassShow.value=res.data.data;
    ProcessingBass.firmName=res.data.data[0].firmName;
    ProcessingBass.productionNo=res.data.data[0].productionNo;
  })
}
//原料
const FeedbackData=reactive({
  feedstockName: "",
  feedstockPhoto: "",
  isDeleted: true
})
const GetFeedbackData=()=>{
  axios.post("https://localhost:44393/api/one/FeedstorkAdd",FeedbackData).then(res=>{
    if(res.data.code==200){
        ElMessage.success(res.data.message);
        return;
    }
    else
    {
      ElMessage.error(res.data.message);
      return;
    }
  })
}
//原料显示
const FeedbackDataShow=ref([]);
const GetFeedbackShow=()=>{
axios.get("https://localhost:44393/api/one/GetFeefstorkShow").then(res=>{
  FeedbackDataShow.value=res.data.data;
  FeedbackData.feedstockName=res.data.data[2].feedstockName;
})
}
//溯源详细
import type { TabsPaneContext } from 'element-plus'
import { dataType } from 'element-plus/es/components/table-v2/src/common.mjs';
import axios from 'axios';
const activeName = ref('first')

const handleClick = (tab: TabsPaneContext, event: Event) => {
  console.log(tab, event)
}


const TC = () => {
  router.push('/')
}
const SY = () => {
  router.push('/Show')
}


const activeIndex = ref('1')
const activeIndex2 = ref('1')
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}

onMounted(() => {
  Getft();
  getshow();
  GetBassShow();
  GettableData();
  GetSlaugShow();
  SlaughterShow();
  GetProcessingShow();
  GetProcessingBassShow();
  GetFeedbackShow();
})
</script>
<style>
.demo-tabs>.el-tabs__content {
  padding: 32px;
  color: #6b778c;
  font-size: 32px;
  font-weight: 600;
}
</style>
